/********************************************************/
/*	Copyright (C) 2016 Gong Li Bin		 	*/
/*	Project:	GoLib-1.0.0			*/
/*	Author:		gong_libin			*/
/*	Date:		2016_01_01			*/
/*	File:		GoChan.go			*/
/********************************************************/

package GoCap

import (
)

/* chan */
type GoChan struct {
	ch	chan interface{}
}

func (c *GoChan) GoChanDel() {
	close(c.ch)
}

func (c *GoChan) GoChanNew(t uint) {
	c.ch = make(chan interface{}, t)
}

func (c *GoChan) GoChanGet() interface{} {
	return <- c.ch
}

func (c *GoChan) GoChanPut(v interface{}) {
	c.ch <- v
}

/* wchn */
type GoWChn struct {
	wc	chan<- interface{}
}

func (c *GoWChn) GoWChnDel() {
	close(c.wc)
}

func (c *GoWChn) GoWChnNew(t uint) {
	c.wc = make(chan<- interface{}, t)
}

func (c *GoWChn) GoWChnPut(v interface{}) {
	c.wc <- v
}

/* rchn */
type GoRChn struct {
	rc	<-chan interface{}
}

func (c *GoRChn) GoRChnNew(t uint) {
	c.rc = make(<-chan interface{}, t)
}

func (c *GoRChn) GoRChnGet() interface{} {
	return <- c.rc
}
